#ifndef PAGEPISSTATIONSELECT_H
#define PAGEPISSTATIONSELECT_H

#include <QWidget>
#include <QSignalMapper>
#include <QPushButton>
#include <QTimer>
#include "popupdialog.h"
#include "globalconfig.h"

namespace Ui {
class PagePisStationSelect;
}

class PagePisStationSelect : public QWidget
{
    Q_OBJECT

public:
    explicit PagePisStationSelect(QWidget *parent = nullptr);
    ~PagePisStationSelect();
    void setPageActive(bool xActive);
    enum
    {
        Select_StartStation,
        Select_DestStation,
        Select_CurrentStation,
        Select_Nothing
    };
    uint16_t getStartStationID(){ return start_station_id_;}
    uint16_t getEndStationID(){ return end_station_id_;}
    uint16_t getCurrentStationID(){ return cur_station_id_;}
public slots:
    void ChangeLineInfo(uint8_t id);
    void slotNextStationPA();
    void slotPreStationPA();
private slots:
    void slotStationBtnClick(int id);
    void on_Btn_PisStartStation_pressed();
    void on_Btn_PisNextStation_pressed();
    void on_Btn_PisDestStation_pressed();
    void on_Btn_PisStationConfirm_clicked();
    void on_Btn_PisDepartConfirm_clicked();
signals:
    void signal_PisStationSet(bool xSet);
    void signal_DepartComfirm(bool xConfirm);
private:
    Ui::PagePisStationSelect *ui;
    QSignalMapper *m_pStationBtnMapper;
    QList<QPushButton *> m_lStationBtnList;
private:
    uint m_nStartx;
    uint m_nStarty;
    uint m_nStationLabelLen;
    uint m_nStationLabelHeight;
    uint m_nHSpace;
    uint m_nVSpace;
    uint8_t m_nColsInRow;
    uint m_nCurLineID;
    int m_nSelecMode;
    uint16_t start_station_id_;
    uint16_t end_station_id_;
    uint16_t cur_station_id_;
    uint8_t cur_station_btn_index_;
private:
    void InitStationBtns();
    int StationSelectIsEmpty();
    void sendStationSetToVCU();
    void sendDepartToVCU();
};

#endif // PAGEPISSTATIONSELECT_H
